/**
 * dva里面的router和react-router-dom 一样
 */
import { Router, Route, Switch } from 'dva/router';
import Login from './pages/login/login';
import Layout from './layout/layout';
import { RouterAPI } from 'dva';

export default function router (api?: RouterAPI) {
  if(api) {
    return (
      <Router history={api.history}>
        <Switch>
          <Route path="/login">
            <Login></Login>
          </Route>
          <Route path="/">
            <Layout></Layout>
          </Route>
        </Switch>
      </Router>
    );
  }
  return {};
};